package com.ts_xiaoa.ts_android_library

import android.os.Bundle
import com.ts_xiaoa.ts_android_library.databinding.ActivityMainBinding
import com.ts_xiaoa.ts_base.utils.showToast
import com.ts_xiaoa.ts_ui.dialog.TsDateDialog
import com.ts_xiaoa.ts_ui.helper.LayoutConfig

class MainActivity : BaseActivity() {

    private val binding by lazy { rootBinding as ActivityMainBinding }

    override fun getLayoutConfig(): LayoutConfig {
        return LayoutConfig(R.layout.activity_main, hasAppbarLayout = true)
    }

    override fun onInit(savedInstanceState: Bundle?) {
        title = "主界面"
    }

    override fun initEvent(savedInstanceState: Bundle?) {
        binding.btnWidget.setOnClickListener {
            TsDateDialog.Builder()
                .setSelectTime(1996, 1, 1)
                .setOnSelectedFinishClickListener { year, month, day, house, minute ->
                    showToast("${year}年${month}月${day}日")
                }
//                .setSelectTime(System.currentTimeMillis())
                .build().show(supportFragmentManager)
        }

        binding.inputCodeView.setOnInputTextChangedListener {
            showToast("输入内容发生了变化>>>>>>>$it")
        }
    }
}